<template>
  <div class="home">
<van-grid square>
  <van-grid-item  icon="tv-o" text="直播" @click='video'/>
  <van-grid-item  icon="scan" text="扫码"   @click='scan'/>
  <van-grid-item  icon="photo-o" text="拍照/相册"   @click='photo'/>
  <van-grid-item  icon="photo-o" text="查看图片"   @click='pic'/>
  <van-grid-item  icon="coupon-o" text="横屏"   @click='Landscape'/>
  <van-grid-item  icon="orders-o" text="竖屏"   @click='Portrait'/>
  <van-grid-item  icon="video-o" text="短视频拍摄"   @click='takevideo'/>
  <van-grid-item  icon="video-o" text="短视频播放"   @click='playvideo'/>
  <!-- <van-grid-item  icon="video-o" text="短视频播放"   @click='playvideo'/> -->

</van-grid>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 'Home',
  created () {
    // 扫码回调
    this.$browser.defineOnBarCodeRead((payload) => {
      const code = payload.data
      alert(code)
    })
  },
  methods: {
    video () {
      // 调起直播页面
      this.$browser.playVideo({ url: 'rtmp://192.168.1.78:1935/live/5ba93bf5f1a7d1cb', name: '茶水间' })
    },
    scan () {
      // 调起扫码页面
      this.$browser.openScanner()
    },
    photo () {

    },
    pic () {

    },
    Landscape () {
      // 横屏
      this.$browser.lockToLandscape()
    },
    Portrait () {
      // 竖屏
      this.$browser.lockToPortrait()
    }
  }

}
</script>
<style>
.home{
  overflow: hidden;
}
</style>
